﻿@page "/bind"

<p>
    <label>
        Normal Blazor binding:
        <input @bind="InputValue" @bind:event="oninput" />
    </label>
</p>

<p>
    <label>
        Demonstration of equivalent HTML binding:
        @*<input value="@InputValue"
            @onchange="@((ChangeEventArgs __e) => InputValue = __e.Value.ToString())" />*@
    </label>
</p>

<p>
    <code>InputValue</code>: @InputValue
</p>

@code {
    private int InputValue { get; set; }
}

<!--与组件参数绑定-->
<h3>Parent Component</h3>

<p>Parent <code>year</code>: @year</p>

<button @onclick="UpdateYear">Update Parent <code>year</code></button>

<BlazorApp.Components.ChildBind @bind-Year="year" />
@code {
    private Random r = new();
    private int year = 1979;

    private void UpdateYear()
    {
        year = r.Next(1950, 2021);
    }
}